<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('project/add')}">新建项目</a></li>
        <li><a href="{:url('project/index')}">项目列表</a></li>     
        <li class="active"><a href="javascript:;">编辑项目</a></li> 
    </ul>
    <form action="{:url('Project/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
    	<input type="hidden" name="id" value="{$result.id}">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th>项目简称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="post[project_short_name]"
                                    required value="{$result.project_short_name}" placeholder="请输入项目名称"/>
                        </td>
                    </tr>

                    <tr>
                        <th>项目名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="post[project_name]"
                                    required value="{$result.project_name}" placeholder="请输入项目名称"/>
                        </td>
                    </tr>
          			
          			<tr>
                        <th>开始时间<span class="form-required">*</span></th>
                        <td>
                            <input type="text" class="form-control js-bootstrap-datetime" name="post[start_time]" autocomplete="off" value="<?php if(!$result['start_time']){ echo '';}else{ echo date('Y-m-d H:i:s',$result['start_time']); }?>">
                        </td>
                    </tr>

                    <tr>
                        <th width="100">公司名称<span class="form-required"></span></th>
                        <td>
                            <input class="form-control" type="text" style="width:400px;" value="{$result.company_name}"
                                   placeholder="点击选择" onclick="company();" id='company_name' 
                                   readonly/>
                           <input type="hidden" id='company_id' name='post[company_id]' value="{$result.company_id}">
                        </td>
                    </tr>
                    
               

                    <tr>
                        <th width="100">项目负责人<span class="form-required"></span></th>
                        <td>
                            <input class="form-control" type="text" style="width:400px;" value="{$result.customer_name}"
                                   placeholder="点击选择" onclick="customer();" id='customer_name' 
                                   readonly/>
                           <input type="hidden" id='customer_id' name='post[customer_id]' value="{$result.customer_id}">
                        </td>
                    </tr>
                   
                  
                    <tr>
                        <th>概述</th>
                        <td>
                            <script type="text/plain" id="content" name="post[project_desc]">{$result.project_desc}</script>
                        </td>
                    </tr>
                   
                    
                </table>
                <hook name="portal_admin_article_edit_view_main"/>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
                        <a class="btn btn-default" href="{:url('project/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                

                <hook name="portal_admin_article_edit_view_right_sidebar"/>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });

    function company() {

        openIframeLayer("{:url('Company/find')}", '公司查找', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var all = iframeWin.confirm();

                $('#company_name').val(all.company_name);
                $('#company_id').val(all.company_id);
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }

    function customer()
    {
        openIframeLayer("{:url('Customer/find')}", '负责人选择', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var all = iframeWin.confirm();

                $('#customer_id').val(all.customer_id);
                $('#customer_name').val(all.customer_name);
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
</body>
</html>
